package com.bsoft.exchange.service;

import com.bsoft.exchange.dao.hss.ReportItemDetailMapper;
import com.bsoft.exchange.domain.ReportItemDetail;
import com.bsoft.exchange.vo.ReportItemDetailVO;
import com.github.dozermapper.core.DozerBeanMapperBuilder;
import com.github.dozermapper.core.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class ReportItemDetailService {
    @Autowired
    private ReportItemDetailMapper reportItemDetailMapper;

    private Mapper mapper = DozerBeanMapperBuilder.buildDefault();

    /**
     * 获取体检报告项目详情
     * @param regRecordCode 预约记录编号
     * @param identityType 证件类型
     * @param identityNo 证件号码
     * @param orgCode 机构编号
     * @return
     */
    public  List<ReportItemDetailVO> getReportItems(String regRecordCode,String identityType, String identityNo,String orgCode){
        List<ReportItemDetail> reportItems = reportItemDetailMapper.getReportItems(regRecordCode, identityType, identityNo, orgCode);
        List<ReportItemDetailVO> reportItemDetailVOS = reportItems.stream().map(reportItemDetail -> mapper.map(reportItemDetail, ReportItemDetailVO.class)).collect(Collectors.toList());
        return reportItemDetailVOS;
    }
}
